package com.chezhujie.www.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chezhujie.www.domain.CzjexpressPic;
import com.chezhujie.www.persistence.CzjexpressPicMapper;
import com.xy.core.exception.ClassCheckException;
import com.xy.user.base.service.BaseService;


/**
 * 用户快递寄回拍照
 * Created by 汤伟杰 on 2017/5/23.
 */
@Service
public class CzjexpressPicService extends BaseService<CzjexpressPic>{
    @Autowired
    private CzjexpressPicMapper czjexpresspicMapper;

    @Autowired
    public void setBaseMapper(CzjexpressPicMapper czjexpresspicMapper) {
        this.baseMapper = czjexpresspicMapper;
    }


    public void checkEntity(CzjexpressPic czjexpresspic) throws ClassCheckException {
        if(czjexpresspic.getExpressPicId()!=null&&czjexpresspic.getExpressPicId().length()>255){
            throw new ClassCheckException("用户快递寄回拍照主键不能超过255个字符");
        }
        if(czjexpresspic.getExpressId()!=null&&czjexpresspic.getExpressId().length()>255){
            throw new ClassCheckException("用户快递寄回拍照快递单号主键不能超过255个字符");
        }
        if(czjexpresspic.getPicPath()!=null&&czjexpresspic.getPicPath().length()>255){
            throw new ClassCheckException("用户快递寄回拍照图片地址不能超过255个字符");
        }
    }
    public void checkListEntity(List<CzjexpressPic> listCzjexpressPic) throws ClassCheckException {

        for (CzjexpressPic czjexpresspic : listCzjexpressPic) {
            checkEntity(czjexpresspic);
        }

    }
}
